/* mmap, munmap
 *
 * map or unmap files or devices into memory
 */

#include <sys/mman.h>

void *mmap(void *addr, size_t length, int prot, int flags,
           int fd, off_t offset);

int munmap(void *addr, size_t length);

/* The port is either PROT_NONE Or a bitwise-of the other values in the
 * following list:
 * 
 * PROT_NONE    The memory cannot be accessed at all.
 * PROT_READ    The memory can be read.
 * PROT_WRITE   The memory can be modified.
 * PROT_EXEC    The memory can be executed.
 *
 * The flags argument determines whether updates to the mapping are visible
 * to other processes mapping the same region, and whether updates are
 * carried through to the underlying file. This behavior is determined by
 * includeing exactly one of the follow values in flags:
 *
 * MAP_SHARED
 *      Share this mapping. Updates to the mapping are visible to other
 *      processes that map this file, and are carried through to the
 *      underlying file. (To precisely control when updates are carried
 *      through to the underlying file requires the use of msync.
 * MAP_PRIVATE
 *      Create a private copy-on-write mapping. Updates to the mapping are
 *      not visible to other processes mapping the same file, and are not
 *      carried through to the underlying file. It is unspecified whether
 *      changes made to the file after the mmap() call are visible in the
 *      mapped region.
 */


/* mprotect
 * 
 * set protection on a region of memory
 */

#include <sys/mman.h>

int mprotect(void *addr, size_t len, int prot);


/* msync
 *
 * synchronize a file with a memory map
 */

#include <sys/mman.h>
int msync(void *addr, size_t length, int flags);
